package com.yuanfeng.business.feign;

import com.yuanfeng.business.dto.ShopClassBindQueryDTO;
import com.yuanfeng.commoms.dto.goods.CommonShopStateDTO;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.goods.GdsBaseDetailResultVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */
@FeignClient(name = "mall-goods", url = "http://localhost:8083")
public interface GoodsServiceClient {

    /**
     * 查询商品状态及库存
     * @param commonId
     * @return
     */
    @PostMapping("goods/common/queryGoodsStartStock")
    List<GdsBaseDetailResultVO> queryGoodsStartStock(@RequestParam("commonId") Integer commonId);
    /**
     * 查询当前商品商品的 售卖区域规则
     * @param goodsIds
     * @return
     */
    @PostMapping("goods/common/selectTransportAreaId")
    List<Integer> selectTransportAreaId(@RequestBody List<Integer> goodsIds);
    /**
     * 查询父类类目id
     * @param param
     * @return
     */
    @PostMapping("/goods/cat/query/parent/cat/id")
    public Integer queryParentCatId(@RequestBody ShopClassBindQueryDTO param);

    /**
     * 查询当前类目id的总数
     * @param param
     * @return
     */
    @PostMapping("/goods/cat/query/child/count")
    public Integer queryChildCount(@RequestParam("param") Integer param);


    /**
     * 查询商品分类 fegin business
     *
     * @param catId
     * @return
     */
    @GetMapping("goods/cat/queryCatByCatId")
    ResponseResult queryCatByCatId(@RequestParam("catId") Integer catId);


    /**
     * 查询商品分类
     *
     * @param map
     * @return
     */
    @PostMapping("goods/cat/query/cat")
    ResponseResult queryCatList(@RequestBody Map<String, Object> map);


    /**
     * 根据三级分类id获取所有父分类的名字
     *
     * @param productClassId
     * @return
     */
    @GetMapping("goods/cat/querySonCatByParentId")
    List<String> querySonCatByParentId(@RequestParam("productClassId") Integer productClassId);


    /**
     * 更新spu商品 除shopId无其他条件
     *
     * @param map
     * @return
     */
    @PostMapping("goods/common/update")
    ResponseResult updateGoodsCommonByMap(@RequestBody Map<String, Object> map);


    /**
     * 更新sku商品 除shopId无其他条件
     *
     * @param map
     * @return
     */
    @PostMapping("goods/base/updateGoodsBase")
    ResponseResult updateGoodsBaseByMap(@RequestBody Map<String, Object> map);

    /**
     * 根据店铺id查找所有commonId
     *
     * @param shopId
     * @return
     */
    @GetMapping("goods/common/query/commonIdListByShopId")
    List<Integer> queryCommonIdList(@RequestParam("shopId") Integer shopId);

    /**
     * 更新spu商品状态
     *
     * @param commonParam
     * @return
     */
    @PostMapping("goods/common/updateGoodsCommonState")
    ResponseResult updateCommonState(@RequestBody CommonShopStateDTO commonParam);


    /**
     * 更新sku商品状态
     *
     * @param commonParam
     * @return
     */
    @PostMapping("goods/base/updateGoodsBaseState")
    ResponseResult updateGoodsState(@RequestBody CommonShopStateDTO commonParam);
}
